package com.gisocn.onemap.ui.adapter;

import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import butterknife.internal.Utils;
import com.gisocn.onemap.interfaces.OnItemClickChildListener;
import com.gisocn.onemap.interfaces.OnItemClickListener;
import com.gisocn.onemap.model.DynamicInfo;
import com.gisocn.onemap.sgzx.R;
import com.gisocn.onemap.utils.L;
import java.util.ArrayList;

/* loaded from: classes2.dex */
public class DynamicQueryAdapter extends RecyclerView.Adapter<ViewHolder> {
    private DynamicQueryChildsAdapter adapter;
    private Context context;
    private ArrayList<DynamicInfo> list;
    private OnItemClickChildListener onItemClickListener = null;

    /* loaded from: classes2.dex */
    public class ViewHolder_ViewBinding implements Unbinder {
        private ViewHolder target;

        public ViewHolder_ViewBinding(ViewHolder viewHolder, View view) {
            this.target = viewHolder;
            viewHolder.tvName = (TextView) Utils.findRequiredViewAsType(view, R.id.tv_name, "field 'tvName'", TextView.class);
            viewHolder.tvCount = (TextView) Utils.findRequiredViewAsType(view, R.id.tv_count, "field 'tvCount'", TextView.class);
            viewHolder.line = Utils.findRequiredView(view, R.id.line, "field 'line'");
            viewHolder.recycleContent = (RecyclerView) Utils.findRequiredViewAsType(view, R.id.recycle_content, "field 'recycleContent'", RecyclerView.class);
        }

        @Override // butterknife.Unbinder
        public void unbind() {
            ViewHolder viewHolder = this.target;
            if (viewHolder == null) {
                throw new IllegalStateException("Bindings already cleared.");
            }
            this.target = null;
            viewHolder.tvName = null;
            viewHolder.tvCount = null;
            viewHolder.line = null;
            viewHolder.recycleContent = null;
        }
    }

    public DynamicQueryAdapter(ArrayList<DynamicInfo> arrayList, Context context) {
        this.list = arrayList;
        this.context = context;
    }

    public void setOnItemClickListener(OnItemClickChildListener onItemClickChildListener) {
        this.onItemClickListener = onItemClickChildListener;
    }

    public void setOnItemClickDynamicListener(OnItemClickChildListener onItemClickChildListener) {
        this.onItemClickListener = onItemClickChildListener;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_query_land, viewGroup, false));
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public void onBindViewHolder(ViewHolder viewHolder, final int i) {
        viewHolder.tvName.setTypeface(Typeface.defaultFromStyle(1));
        if (i == 0) {
            viewHolder.tvName.setVisibility(0);
            viewHolder.tvName.setText(this.list.get(i).getGroupName());
            viewHolder.tvName.setVisibility(8);
        } else if (this.list.get(i).getGroupName().equals(this.list.get(i - 1).getGroupName())) {
            viewHolder.tvName.setVisibility(8);
        } else {
            viewHolder.tvName.setVisibility(0);
            viewHolder.tvName.setText(this.list.get(i).getGroupName());
        }
        viewHolder.tvCount.setVisibility(8);
        TextView textView = viewHolder.tvCount;
        textView.setText(this.list.get(i).getGetGraphics().size() + "条记录");
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.context);
        linearLayoutManager.setOrientation(1);
        viewHolder.recycleContent.setLayoutManager(linearLayoutManager);
        this.adapter = new DynamicQueryChildsAdapter(this.list.get(i), this.list.get(i).getLayerName());
        viewHolder.recycleContent.setAdapter(this.adapter);
        this.adapter.setOnItemClickListener(new OnItemClickListener() { // from class: com.gisocn.onemap.ui.adapter.DynamicQueryAdapter.1
            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i2, int i3) {
            }

            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i2) {
                if (DynamicQueryAdapter.this.onItemClickListener != null) {
                    DynamicQueryAdapter.this.onItemClickListener.onItemClick(view, i, i2);
                }
            }
        });
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public int getItemCount() {
        L.e("一级属性查询结果" + this.list.size());
        return this.list.size();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes2.dex */
    public static class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.line)
        View line;
        @BindView(R.id.recycle_content)
        RecyclerView recycleContent;
        @BindView(R.id.tv_count)
        TextView tvCount;
        @BindView(R.id.tv_name)
        TextView tvName;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
